package com.ai.bitcoin.weixin.template;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 积分变动推送模板
 */
public class BonusChangeTemplate extends BaseTemplate {

    private final String templateId = "BIW4uI70fUP1O74eJGqn4nabUV8FAXnPKO5VCCx-Ua8";


//    {{first.DATA}}
//
//        {{FieldName.DATA}}:{{Account.DATA}}
//        {{change.DATA}}积分:{{CreditChange.DATA}}
//        积分余额:{{CreditTotal.DATA}}
//        {{Remark.DATA}}

//    您的积分账户变更如下
//
//    增加积分：34
//    积分余额：5623
//
//    您可以在网站或手机APP使用积分下单抵现，10积分=1元。
    @Override
    public Map<String, Object> buildParameterMap(Map<String, Object> request) {
        Map<String,Object> resp = Maps.newHashMap();
        resp.put("touser", request.get("openId"));
        resp.put("template_id", templateId);
//        resp.put("url", request.get("url"));
        resp.put("url", "https://www.valuechain.group/template/personalCenter/personalCenter.html");
        Map<String,Object> dataMap = Maps.newHashMap();
        dataMap.put("first", buildDataMap(String.valueOf(request.get("first"))));
        dataMap.put("FieldName", buildDataMap(String.valueOf(request.get("FieldName"))));
        dataMap.put("Account", buildDataMap(String.valueOf(request.get("Account"))));
        dataMap.put("change", buildDataMap(String.valueOf(request.get("change"))));
        dataMap.put("CreditChange", buildDataMap(String.valueOf(request.get("CreditChange"))));
        dataMap.put("CreditTotal", buildDataMap(String.valueOf(request.get("CreditTotal"))));
        if(request.get("Remark") != null) {
            dataMap.put("Remark", buildDataMap(String.valueOf(request.get("Remark"))));
        }
        resp.put("data", dataMap);
        return resp;
    }
}
